package com.itheima.service.impl;

import com.itheima.cammon.PageInof;
import com.itheima.mapper.OrderMapper;
import com.itheima.pojo.Order;
import com.itheima.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author 王同学
 */
@Service
@Slf4j
public class OrderServiceimpl implements OrderService {
    @Autowired
    OrderMapper orderMapper;
    @Override
    public PageInof<Order> page(String beginTime, String endTime, String number, Integer page, Integer pageSize) {
        //分页查询
        PageInof<Order> pageInof=new PageInof<>();
        //公式
        Integer start=(page-1)*pageSize;
        List<Order> emp = orderMapper.page(beginTime,endTime,number, start, pageSize);
        pageInof.setRecords(emp);
        pageInof.setSize(pageSize);
        pageInof.setCurrent(start);
        return pageInof;
    }

    @Override
    public boolean updatestatus(int status, String id) {

        return orderMapper.updateStatus(status,id);
    }
}
